package org.example.rowing.controller;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import lombok.extern.slf4j.Slf4j;
import org.example.rowing.controller.util.BaseController;
import org.example.rowing.controller.util.NavigationUtil;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Slf4j
@Component
public class HelpInfoController extends BaseController {
    @FXML
    private VBox sideNav;
    @FXML
    private Button btnHelp;


    @FXML
    private void handleNavButtonClick(ActionEvent event) throws IOException {
        log.info("当前触发事件为：{}",event);
        Button clickedButton = (Button) sideNav.getScene().getFocusOwner();
        NavigationUtil.navigateToScene(
                event,
                NavigationUtil.viewMap.get(clickedButton.getId()),
                "赛艇管理");
    }

    // 对皮划艇菜单点击的处理
    @FXML
    public void handleBoatTypeClick(ActionEvent event) throws IOException {
        log.info("切换到皮划艇界面");
        NavigationUtil.navigateToScene(
                (Stage) sideNav.getScene().getWindow(),
                "/fxml/canoeAndKayakViews/CKEventInfoView.fxml",
                "皮划艇管理");
    }


    @Override
    protected Button getButton() {
        return btnHelp;
    }
}
